3a3804
@@ -132,24 +132,26 @@
private void handleAlterTableTransactionalProp(PreAlterTableEvent context) throw
     }
     if ("true".equalsIgnoreCase(transactionalValue) && !"true".equalsIgnoreCase(oldTransactionalValue)) {
       if(!isTransactionalPropertiesPresent) {
-        normazlieTransactionalPropertyDefault(newTable);
+        normalizeTransactionalPropertyDefault(newTable);
         isTransactionalPropertiesPresent = true;
         transactionalPropertiesValue = DEFAULT_TRANSACTIONAL_PROPERTY;
       }
-      //only need to check conformance if alter table enabled acid
-      if (!conformToAcid(newTable)) {
-        // INSERT_ONLY tables don't have to conform to ACID requirement like ORC or bucketing
-        if (transactionalPropertiesValue == null || !"insert_only".equalsIgnoreCase(transactionalPropertiesValue)) {
-          throw new MetaException("The table must be stored using an ACID compliant format (such as ORC): "
-          + Warehouse.getQualifiedName(newTable));
-        }
+      // We only need to check conformance if alter table enabled acid.
+      // INSERT_ONLY tables don't have to conform to ACID requirement like ORC or bucketing.
+      boolean isFullAcid = transactionalPropertiesValue == null
+          || !"insert_only".equalsIgnoreCase(transactionalPropertiesValue);
+      if (isFullAcid && !conformToAcid(newTable)) {
+        throw new MetaException("The table must be stored using an ACID compliant "
+            + "format (such as ORC): " + Warehouse.getQualifiedName(newTable));
       }
 
       if (newTable.getTableType().equals(TableType.EXTERNAL_TABLE.toString())) {
         throw new MetaException(Warehouse.getQualifiedName(newTable) +
             " cannot be declared transactional because it's an external table");
       }
-      validateTableStructure(context.getHandler(), newTable);
+      if (isFullAcid) {
+        validateTableStructure(context.getHandler(), newTable);
+      }
       hasValidTransactionalValue = true;
     }
 
@@ -189,6 +191,7 @@
private void handleAlterTableTransactionalProp(PreAlterTableEvent context) throw
     }
     checkSorted(newTable);
   }
+
   private void checkSorted(Table newTable) throws MetaException {
     if(!TxnUtils.isAcidTable(newTable)) {
       return;
@@ -309,7 +312,7 @@
private void handleCreateTableTransactionalProp(PreCreateTableEvent context) thr
       // normalize prop name
       parameters.put(hive_metastoreConstants.TABLE_IS_TRANSACTIONAL, Boolean.TRUE.toString());
       if(transactionalProperties == null) {
-        normazlieTransactionalPropertyDefault(newTable);
+        normalizeTransactionalPropertyDefault(newTable);
       }
       initializeTransactionalProperties(newTable);
       checkSorted(newTable);
@@ -325,7 +328,7 @@
private void handleCreateTableTransactionalProp(PreCreateTableEvent context) thr
    * transactional_properties should take on the default value.  Easier to make this explicit in
    * table definition than keep checking everywhere if it's set or not.
    */
-  private void normazlieTransactionalPropertyDefault(Table table) {
+  private void normalizeTransactionalPropertyDefault(Table table) {
     table.getParameters().put(hive_metastoreConstants.TABLE_TRANSACTIONAL_PROPERTIES,
         DEFAULT_TRANSACTIONAL_PROPERTY);
 
